//获取应用实例
var server = require('../../util/server.js');
var app = getApp();
Page({
  data: {
    items:[
      /*{
        status:1,
        user_id:123,
        user_name:'小明',
        begin_time:'2016-06-07',
        end_time:'2016-08-10',
        activity_people_number:10,
        user_phone:'123456789',
        activity_info:'说明,说明2,说明3'
      },
      {
        status:1,
        user_id:123,
        user_name:'小明',
        begin_time:'2016-06-07',
        end_time:'2016-08-10',
        activity_people_number:10,
        user_phone:'123456789',
        activity_info:'说明,说明2,说明3'
      }*/
    ],
    loadingHidden:false
  },
  onLoad: function() {
      /*console.log('b')
    var that = this;
     app.getUserInfo()
        .then(info => {
          this.setData({ userInfo: info })
            server.resource('userPlace',{user_id:info.avatarUrl}).then(function(res){
            that.setData({
              items: res.data.data
            });
            setTimeout(function () {
              that.setData({
                loadingHidden: true
              })
            }, 1500);
          });
          })
        .catch(console.info)*/
  
  },
    onShow:function(){
        var that = this;
        app.getUserInfo()
            .then(info => {
            this.setData({ userInfo: info })
        server.resource('userPlace',{user_id:info.avatarUrl}).then(function(res){
            that.setData({
                items: res.data.data
            });
            setTimeout(function () {
                that.setData({
                    loadingHidden: true
                })
            }, 1500);
        });
    })
        .catch(console.info)
    }
})
